<script setup lang="ts">
import { getSysPostList } from "@/views/domain/admin/api/sysPost";
import { computed, onMounted, ref } from "vue";

const props = defineProps<{
  modelValue?: string;
}>();

const emit = defineEmits(["update:modelValue", "change"]);
const postId = computed({
  get: () => props.modelValue,
  set: value => {
    emit("update:modelValue", value);
    emit("change", value);
  }
});
const postList = ref([]);
const getPostList = async () => {
  const { data } = await getSysPostList({ pageNum: 1, pageSize: 1000 } as any);
  postList.value = data.list;
};

onMounted(() => {
  getPostList();
});
</script>

<template>
  <el-select-v2
    v-model="postId"
    placeholder="请选择职位"
    :options="postList"
    :props="{
      value: 'postId',
      label: 'postName'
    }"
  />
</template>
<style lang="scss" scoped></style>
